package com.han.walkman.service.impl;

import com.han.walkman.dao.VisitedBusinessDao;
import com.han.walkman.entity.VisitedBusinessEntity;
import com.han.walkman.service.VisitedBusinessService;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @Author: Hanjiafeng
 * @Date: 2020/7/7
 * @Desc:
 */
@Service
public class VisitedBusinessServiceImpl implements VisitedBusinessService {
    private final VisitedBusinessDao visitedBusinessDao;

    public VisitedBusinessServiceImpl(VisitedBusinessDao visitedBusinessDao) {
        this.visitedBusinessDao = visitedBusinessDao;
    }

    @Override
    public void addList(List<VisitedBusinessEntity> visitedBusinessEntityList) {
        visitedBusinessDao.saveAll(visitedBusinessEntityList);
    }

    @Override
    public void add(VisitedBusinessEntity visitedBusinessEntity) {
        visitedBusinessDao.save(visitedBusinessEntity);
    }

    @Override
    public Page<VisitedBusinessEntity> findAll(Pageable pageable) {
        return visitedBusinessDao.findAll(pageable);
    }

    @Override
    public List<VisitedBusinessEntity> findAll(Example<VisitedBusinessEntity> entityExample) {
        return visitedBusinessDao.findAll(entityExample);
    }

    @Override
    public Page<VisitedBusinessEntity> findAll(Example<VisitedBusinessEntity> entityExample, Pageable pageable) {
        return visitedBusinessDao.findAll(entityExample, pageable);
    }

    @Override
    public Optional<VisitedBusinessEntity> findById(Integer id) {
        return visitedBusinessDao.findById(id);
    }
}
